<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title>伪元素before after</title>
		<style>
			.squares{
				font-size: 10px;
				width: 15em;
				height: 15em;
				position: relative;
				display: flex;
				align-items: center;
				justify-content: center;
			}
			.squares div{
				position: absolute;
				box-sizing: border-box;
				border: 1em solid dimgray;
			}
			.squares div:nth-child(1){
				width: 100%;
				height: 100%;
			}
			.squares div:nth-child(2){
				width: 70%;
				height: 70%;
			}
			.squares div:nth-child(3){
				width: 40%;
				height: 40%;
			}
			.squares div::before, .squares div::after{
				content: '';
				position: absolute;
				width: 1em;
				height: calc(50% + 1em);
				background-color: gold;
			}
			.squares div::before{
				top: -1em;
				left: -1em;
			}
			.squares div::after{
				bottom: -1em;
				right: -1em;
			}
		</style>
	</head>
	<body>
		<figure class="squares">
			<div></div>
			<div></div>
			<div></div>
		</figure>
	</body>
</html>
